package com.shijie.component.tencent;

import com.github.qcloudsms.SmsSingleSender;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@ConditionalOnClass(SmsSingleSender.class)
@EnableConfigurationProperties(SmsProperties.class)
public class SmsConfiguration {

    @Autowired
    private SmsProperties smsProperties;

    @Bean
    public SmsSingleSender smsSingleSender() {
        return new SmsSingleSender(smsProperties.getAppId(), smsProperties.getAppKey());
    }

}
